Portal Engine
Version 3.x > Portal Engine > Selecting Transformation with {%classname%} View modes: 
User avatar
Member
Member
fredrik.walden - 9/12/2008 5:18:46 AM
   
Selecting Transformation with {%classname%}
I'm trying to figure out the selection of transformations using the classname macro, but I have a few questions.

I've created two new document types, ImageBanner and FlashBanner.
Both with different default transitions.
Both can be placed as children of a Page (MenuItem).
On the page template I have a repeater that i want to render using the child items of the page (with the content filter of ImageBanner and FlashBanner). I'm trying to do this setting the transformation to "{%classname%}.default" but for some reason the macro picks the class name of the parent document and the repeater uses the MenuItem.default transformation on all of the items. Is there a macro for finding out the class name of the child item instead of the parent object?

If I use <%# Eval("classname") %> in the transformation the text rendered are "ImageBanner" or "FlashBanner".

The only solution seems to be to make a generic document type that has a transformation with logic that renders differently given the evaluated value of "classname". In my opinion it would be a really ugly solution (from a OOD point of view) to just paste the different transformations of the two different document types straight into the generic transformation. Is it possible to somehow (using a usercontrol or something like that) dynamically grab the items document transformation from within the generic transformation?

Am I on the right track, or is there an easier way of achieving what I want?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 9/17/2008 8:11:42 AM
   
RE: Selecting Transformation with {%classname%}
Hello,

This macro is intended for 'Selected item transformation'. In this case, if you select some item in transformation to come to its detail, the selected document (ImageBanner or FlashBanner) should act as current document and its default transformation should be used.
Unfortunately, it is not possible to ensure request functionality using classname macro for 'Transformation' as this scenario is not supported. I'm afraid you will need to try to ensure this functionality using some generic transformation even if it is not elegant solution.

Best Regards,

Martin Dobsicek.